<div class="setting com_width">
    <?php include PROJECT_PATH . 'Application/View/menu.tpl.php';?>
    <div class="menu_head"></div>
    <div class="right">
    	<div class="modellist">
        	<div class="search">
        	 <span class="title_name">类型:</span>
	       	 <select id="style" class="search_style text hover" onchange="search()">
	       	 	<option value="0" <?php if($search['style'] == 0){?>selected="selected"<?php }?>>全部</option>
	            <?php foreach($modelStyle as $k=>$v){ ?>
	            <option value="<?=$k?>" <?php if($search['style'] == $k){?>selected="selected"<?php }?>><?=$v?></option>
	            <?php }?>
	        </select>
        	</div>
        </div>
        <?php foreach ($models as $model){?>
        <div class="modellist">
            <div class="info">
                <div class="modlename">
                	<?php 
                	if($model['nickname'] != '') echo $model['nickname'];
                	else echo $model['modelname'];
                	?>
                </div>
                <div class="operate">
                    <span class="func btn link">
                        <a target="_blank" href="http://<?=HOST?>/model/detail/modelid/<?=$model['modelid']?>">查看</a>
                    </span>
                    <?php if(Model_User::getLevelID() == 2 || Model_User::getLevelID() == 5){?>
                    <span class="func btn link">
                        <a target="_blank" href="http://<?=HOST?>/model/modify/modelid/<?=$model['modelid']?>">修改</a>
                    </span>
                    <span class="func btn" onclick="del(<?=$model['modelid']?>);" >删除</span>
                    <?php }?>
                </div>
            </div>
        </div>
        <?php }?>
        <div class="page">
        	<?php if(empty($models)){?>
				<div style="margin-left:260px">暂无模特信息</div>
			<?php }else{?>     
          <span><a href="http://<?=HOST?>/model/list/page/<?=$pageNav['firstPage']?>/style/<?=$search['style']?>">[首页]</a></span>
            <span><a href="http://<?=HOST?>/model/list/page/<?=$pageNav['prePage']?>/style/<?=$search['style']?>">[上一页]</a></span>
            <?php foreach ($pageNav['pageList'] as $pageNum){
                  if($pageNum != $pageNav['nowPage']){ 
            ?>
            <span>
            <a href="http://<?=HOST?>/model/list/page/<?=$pageNum?>/style/<?=$search['style']?>">[<?=$pageNum?>]</a>
            </span>
            <?php }else{ ?>
            <span><?=$pageNum?></span>
            <?php }}?>
            <span><a href="http://<?=HOST?>/model/list/page/<?=$pageNav['nextPage']?>/style/<?=$search['style']?>">[下一页]</a></span>
            <span><a href="http://<?=HOST?>/model/list/page/<?=$pageNav['lastPage']?>/style/<?=$search['style']?>">[尾页]</a></span>
            <?php }?>
        </div>
    </div>
</div>
<script type="text/javascript">
    function del(id)
    {
    	if(!confirm("确定删除吗？删除后不可恢复"))
    	{
        	return;
    	}

        $.ajax({
              url: "http://<?=HOST?>/model/doDel",
              cache: false,
              timeout:10000,
              type: "POST",
              data: {
                  modelid:id
              },
              dataType: "json",
              beforeSend: function() {
                  disableHTML(true, '请稍等，处理中……', true);
              },
              success: function(data) {
                  if(data.errCode != 0){
                    disableHTML(true, data.errMsg, false);
                        setTimeout(disableHTML,2000);
                  }else{
                    disableHTML(true, '处理成功，跳转中……', true);
                    setTimeout("location.href = 'http://<?=HOST?>/model/list'",1000);
                  }
              },
              error:function(){
                  disableHTML(true, "请求出错，请重试或联系管理员", false);
                  setTimeout(disableHTML,2000);
              }
            });
    }
    function search()
    {
    	style = $("#style").val();
    	location.href = "http://<?=HOST?>/model/list/page/<?=$pageNav['nextPage']?>/style/" + style;
    }
</script>








